﻿@model IEnumerable<HopNguyenModel.Content>
@{
    ViewBag.Title = "Quản lý sản phẩm";
    Layout = "~/Views/Shared/_BackendLayout.cshtml";
}


<div class="page-header position-relative">
    <h1>Quản lý sản phẩm
    </h1>
</div>
<!--/.page-header-->
<div class="row-fluid">
    <div class="choose-type">
        <div class="span2">
            <a href="/Cpanel/CreateProduct" class="btn btn-primary">Tạo mới</a>
        </div>
        <div class="span4">
            <strong>Lọc nhóm cha</strong> @Html.DropDownList("TypeId", null, "[No filter]", new { onchange = "typeidchange(this.value)" })
        </div>
    </div>
</div>
<div class="row-fluid">
    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
        <thead>
            <tr>
                <th>Id</th>
                <th>Tên</th>
                <th>Giá bán</th>
                <th>Hình ảnh</th>
                <th>Trạng thái</th>
                <th>Lượt xem</th>
                <th>Danh mục</th>
                <th>Action</th>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model)
            {
                <tr>
                    <td>@item.Id</td>
                    <td style="text-align: left"><a href="/Cpanel/EditProduct/@item.Id">@item.Name</a></td>
                    <td>@string.Format("{0:N0} VNĐ", item.Price)</td>
                    <td>@(item.Image != null ? Html.Raw("<a href='/Cpanel/EditProduct/" + item.Id + "'><img src=\"" + item.Image + "\" width='100px' height='80px'></a>") : Html.Raw(""))</td>
                    <td>@(item.Status == true ? Html.Raw("<span class=\"label label-success arrowed\">Hiện</span>") : Html.Raw("<span class=\"badge badge-important\">Ẩn</span>"))</td>
                    <td>@item.Hit</td>
                    <td>@item.TypeContent.Name</td>
                    <td>
                        <a href="/Cpanel/EditProduct/@item.Id" title="Sửa">Sửa</a> | 
                            <a href="/Cpanel/DeleteProduct/@item.Id" onclick="javascript:return confirm('Are you sure?');" title="Xóa">Xóa</a>
                    </td>
                </tr>
            }
        </tbody>
    </table>
</div>
